package com.xmwzw.catpu.http;



import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

public class RetrofitUtil {
    private static RetrofitUtil instance;
    private static final long TIME_OUT = 15l;

    public synchronized static RetrofitUtil getInstance() {
        if (instance == null) {
            instance = new RetrofitUtil();
        }

        return instance;
    }

    private MyHttpLoggingInterceptor loggingInterceptor = new MyHttpLoggingInterceptor()
            .setLevel(MyHttpLoggingInterceptor.Level.BODY);

    public OkHttpClient getClient() {
        return new OkHttpClient.Builder()
                .addInterceptor(loggingInterceptor)
                .connectTimeout(TIME_OUT,TimeUnit.SECONDS)
                .readTimeout(TIME_OUT, TimeUnit.SECONDS)
                .writeTimeout(TIME_OUT,TimeUnit.SECONDS)
                .build();
    }



}
